package com.cortex.carambola.view;

import com.cortex.carambola.summary.CarambolaRequestSummary;
import com.cortex.carambola.view.CortexRowSearch.ISlidFinger;
import com.cortex.carambolasummary.R;

import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.View;

import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.ViewFlipper;


public class QuestionSummaryView extends RelativeLayout{
	
	private ImageView imgYes;
	CortexTextView tvIgnore;
	private OnActionQuestionSummaryView onActionQuestionSummaryView;
	
	public QuestionSummaryView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public QuestionSummaryView(Context context) {
		super(context);
	}
	@Override
	protected void onFinishInflate() {
		// TODO Auto-generated method stub
		super.onFinishInflate();
		init();
	}
	
	private void init(){
		imgYes = (ImageView)findViewById(R.id.imgYes);
		tvIgnore = (CortexTextView)findViewById(R.id.tvIgnore);
		initHandlers();
	}
	private void initHandlers(){
		imgYes.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				if(onActionQuestionSummaryView != null){
					CarambolaRequestSummary requestSummary = new CarambolaRequestSummary();
					onActionQuestionSummaryView.getSummary(requestSummary);
				}
				hide();
			}
		});
		tvIgnore.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				if(onActionQuestionSummaryView != null){
					onActionQuestionSummaryView.igonre();
				}
				hide();
			}
		});
	}
	private void hide(){
		setVisibility(View.GONE);
	}
	public void setOnActionQuestionSummaryView(OnActionQuestionSummaryView onActionQuestionSummaryView) {
		this.onActionQuestionSummaryView = onActionQuestionSummaryView;
	}
	public void show(){
		setVisibility(View.VISIBLE);
	}
	public interface OnActionQuestionSummaryView{
		void getSummary(CarambolaRequestSummary requestSummary);
		void igonre();
	}
}
